<%@page import="Product.ProductVo"%>
<%@page import="java.util.ArrayList"%>
<%@page import="Product.ProductMyba"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%request.setCharacterEncoding("utf-8"); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<link href="${pageContext.request.contextPath }/homepage/product/product.css" rel="stylesheet">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>상품 리스트</title>
<style type="text/css">
.list{
float: left;
width:15%; 
line-height: 30px; 
text-align: center;
border-bottom:1px solid #eaeaea;
}
</style>
<script type="text/javascript">
var cnt=0;
function getId(id){ return document.getElementById(id)}
function goPage(page){
	
	var ff=document.community_form;
	ff.nowPage.value=page;

	ff.action='index.jsp?inc_content=./product/product_list.jsp&nowPage='+page;
		ff.submit();
}
function init(){	
	getId('btnSearch').onclick=function(){
		community_form.action='index.jsp?inc_content=./product/product_list.jsp';
		var np=document.getElementById('nowPage');
		np.value='1';
		community_form.submit();
	}
	
}
function viewgo(pd){

	location.href='index.jsp?inc_content=./product/product_view.jsp?PD_no='+pd;
}
</script>
</head>
<body>
	<jsp:useBean id="vo" class="Product.ProductVo" />
	<jsp:setProperty property="*" name="vo" />

<%
ProductMyba product=new ProductMyba();
product.setProductvo(vo);
ArrayList<ProductVo> data=product.list();
%>


	<div id="PMain">
		<form name='community_form' method="post">
		<div id="PTop" class="panel panel-default">
		
	<!-- Tabs  ================================================== -->
 
    <h2 id="tabs-예제">상품 검색</h2>
    <div class="bs-example bs-example-tabs">
      <ul id="myTab" class="nav nav-tabs">
          
      </ul>
       	<div style="width:215px; margin:15px; margin-left:680px;"> 
        		<div style="width: 150px; display: inline-block;"><input type="text" placeholder="상품명을 입력해주세요." class="form-control" name='find' value='<%=vo.getFind() %>' ></div>	
         			<div style="float: right;"><input type="submit" value="검색" class="btn btn-info" id="btnSearch" ></div>
         			<input type="hidden" name='nowPage' id='nowPage' value='<%=product.getNowPage() %>'>
        	</div>
     </div>
    
    <!-- /example -->
      	</div>
		
		
		<div id="PContent" class="panel panel-default" style="margin-top:33px;">
			<div style="height: 30px; border-top: 2px solid #eaeaea; border-bottom: 2px solid #eaeaea">
				<div style="float: left; width:40%; line-height: 30px; text-align: center;">상품명</div>
				<div style="float: left; width:15%; line-height: 30px; text-align: center;">대출기간</div>
				<div style="float: left; width:15%; line-height: 30px; text-align: center;">대출금리</div>
				<div style="float: left; width:15%; line-height: 30px; text-align: center;">상환방식</div>
				<div style="float: left; width:15%; line-height: 30px; text-align: center;">대출한도</div>
			</div>
			<div>
				<%
				for(int i=0; i<data.size(); i++){
					ProductVo pv=data.get(i);
				%>
					<div class='list' style="width:40%; font-weight: bold; " onclick="viewgo('<%=pv.getPD_no() %>')" ><%=pv.getPD_nm() %></div>
					<div class='list'><%=pv.getPD_prd() %></div>
					<div class='list'><%=pv.getPD_rate() %></div>
					<div class='list'><%=pv.getPD_pback() %></div>
					<div class='list'><%=pv.getPD_max() %></div>
				<%}%>
			</div>
		</div>
		<div id="PBottom" >
			<div style="text-align: center; ">
				<!-- 페이지 분리 영역 -->
				<%
					if(product.getNowBlock()>1){
				%>
				<input type="button" value="맨첨" onclick="goPage(1)"> <input
					type="button" value="이전"
					onclick="goPage(<%=product.getNowPage()-1%>)">
				<%
					}
				%>
				<%
					for(int p=product.getStartPage(); p<=product.getEndPage();p++){
				%>
				<input type="button" value="<%=p%>" onclick="goPage('<%=p%>')" style="margin-top:10px;">
				<%
					}
				%>
			</div>
		</div>
		</form>
	</div>
<script type="text/javascript">init()
</script>	
</body>
</html>